package cn.dkk.behavior_design.observer.java_observer;

import java.util.Observable;
import java.util.Observer;

/**
 * @author dkk
 * @date 2022/7/26
 * @desc 观察者(订阅者)
 */
public class User implements Observer {

    private String name;

    public User(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        System.out.println(name+"接收到了"+((Weibo) o).getName()+"的消息+"+arg);
    }
}
